UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iyBYm6htAbKb0d8OIuu4j1g4NYe+7ezUT5u5h1paob4='
WHERE
key_id = 'c3f283fcce9381c5ed856b355d0fb9bdcf63bb9be443eb296c4955665c1591c3'
AND (
token = 'iyBYm6htAbKb0d8OIuu4j1g4NYe+7ezUT5u5h1paob4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)