UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'syZ93spzTNnvcwK03LJNI9BhXmHElXG3luGtHaAg85E='
WHERE
key_id = '590ebe402e9cb4f8668318d8d934920eb6da0c9adc40f6745816632d2ed207d1'
AND (
token = 'syZ93spzTNnvcwK03LJNI9BhXmHElXG3luGtHaAg85E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)