UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xCqqNUYNAe/H9UrVQ29/l8fJvQsNh6chN322CuCKZhw='
WHERE
key_id = '397b45beddf6b0c051a3e116eb89224d6393d0aaf2a0d1f9a2f86cf99ae613f1'
AND (
token = 'xCqqNUYNAe/H9UrVQ29/l8fJvQsNh6chN322CuCKZhw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)