UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TPHlhekpC1xfxCqYMUtzKJgaCOPVSBoojuYRnZW7YlU='
WHERE
key_id = '4e2461e2da6178994727d145828bcfba30b4137d3a6da31927a8ea0088382f8d'
AND (
token = 'TPHlhekpC1xfxCqYMUtzKJgaCOPVSBoojuYRnZW7YlU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)