UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PPEU2A0QO9R5gOndDVV6lLwxq45tqpWDTj5W024Xgzc='
WHERE
key_id = '131b6122cad9ef379a0a252ad62fc5cf38e009646ce3eea0e9084ecf14c87e37'
AND (
token = 'PPEU2A0QO9R5gOndDVV6lLwxq45tqpWDTj5W024Xgzc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)