UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j+R4vFcrb7Obg0lM7Y1hK+BtNni+nkdyzGLHrNsenVc='
WHERE
key_id = '8bd21d52c75401ac64c3f1938cce8f84973047ae8a8a2135654ec870069bf18b'
AND (
token = 'j+R4vFcrb7Obg0lM7Y1hK+BtNni+nkdyzGLHrNsenVc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)