UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W39MqaXUjaMiwdVJ+TfwsVmHo479aDcGv14gexW5mDU='
WHERE
key_id = 'ff26c0c96ec2762ba94f3d6dbf94603331ce4692fb49df271d90cceef3edb78e'
AND (
token = 'W39MqaXUjaMiwdVJ+TfwsVmHo479aDcGv14gexW5mDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)