UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XGqll+xeG4I/RR5QueCa1ZCT05y8Nf7Do41ySVUYf+w='
WHERE
key_id = '87e7dd1839a24ae1acecab44c7e0fb7b1bd9e4864f099e3b26142d68259ffa22'
AND (
token = 'XGqll+xeG4I/RR5QueCa1ZCT05y8Nf7Do41ySVUYf+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)