UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CyAwwKWUwDibgflhnn6y+5l3Jhuhnc+g2m7v6z8x0t0='
WHERE
key_id = '8a338c501433ecefb5878a25300543cebaef652efcc5503cb07d23162de5c054'
AND (
token = 'CyAwwKWUwDibgflhnn6y+5l3Jhuhnc+g2m7v6z8x0t0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)