UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Iwj0e5QTNZIxQPMbcoATfrH7JH/BDx7Wt87MSym72bM='
WHERE
key_id = '512177bf6693b63a102e89a55b6c7f9745bf23bd975ba5cb6f8af776352c5f7c'
AND (
token = 'Iwj0e5QTNZIxQPMbcoATfrH7JH/BDx7Wt87MSym72bM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)