UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ES57zi8WQgiff9CvaloG7ccMWa2Yjml+kH6cG6EBeJ4='
WHERE
key_id = '42a1fd3a6addf71839d0f22cefef153b4bb312e8acd9310b1b9d078aa648e544'
AND (
token = 'ES57zi8WQgiff9CvaloG7ccMWa2Yjml+kH6cG6EBeJ4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)