UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EmL7AaHn6m2gzLVM1WBhGoJlct4J3tGRfQPxrSo1S74='
WHERE
key_id = '31b14f9959d5c542a02cadcb1310427cdc221335c9a9a726e807069dc41272e5'
AND (
token = 'EmL7AaHn6m2gzLVM1WBhGoJlct4J3tGRfQPxrSo1S74='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)