UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qJl8h6CKlvFJXCN58Cq7Ecl4XB1vI8AiHePBpKns8k0='
WHERE
key_id = '687501af8a3abd599eadfed9f7d1ea9bcdccec0a496a445fc5f5bb5217d9e0b1'
AND (
token = 'qJl8h6CKlvFJXCN58Cq7Ecl4XB1vI8AiHePBpKns8k0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)