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