UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jiOm+2B3kCJ0ovuMKs83Z7jMPPiNWLV5koydi+pOdZo='
WHERE
key_id = 'ba103a0185edb5dc8c6521af0c530f27a03af619b098a11a319219dc6ae12d52'
AND (
token = 'jiOm+2B3kCJ0ovuMKs83Z7jMPPiNWLV5koydi+pOdZo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)