UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HI5gPLIbX9JGP0+lciLKTHGX+9eCVljv4gHEn3ofJdE='
WHERE
key_id = 'c917c73f388acae5f8d4ab98c72c0a6535f58c85b4c1c65973e19186346a6569'
AND (
token = 'HI5gPLIbX9JGP0+lciLKTHGX+9eCVljv4gHEn3ofJdE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)