UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'COmBkiyJMa9ygL7hVedzLEDww6ZpeWy5QzJgh9JXmPw='
WHERE
key_id = 'c5270a8a9a0fd6f3c2edc8881cdccd9ab65da7b8b99f44b365047fb4107f3121'
AND (
token = 'COmBkiyJMa9ygL7hVedzLEDww6ZpeWy5QzJgh9JXmPw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)