UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vgIwdAk9Ae9NBqedle0Af0WwaZutNZ6MWc8caYUO+KA='
WHERE
key_id = '8dc5dd7055e725d40b29982bc972c83f6d819405fe9deba0d631318dfd895d13'
AND (
token = 'vgIwdAk9Ae9NBqedle0Af0WwaZutNZ6MWc8caYUO+KA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)