UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nYiuNcWI7Vf9CV7TLtekBCEL+AUFOEfL1Buw1XYKKas='
WHERE
key_id = 'd2b47075430d0a8284640d5e212b158ead3319a9a3271898313d9f054bc31ca5'
AND (
token = 'nYiuNcWI7Vf9CV7TLtekBCEL+AUFOEfL1Buw1XYKKas='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)