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