UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fDltRLlFfj8Mvfv5c4S8Mo5ASo3nlT5ZJSwhZ5Xb3LE='
WHERE
key_id = '123e867c352fa3543f4734597578a2e537969faf355af5c0c172fa52482e8312'
AND (
token = 'fDltRLlFfj8Mvfv5c4S8Mo5ASo3nlT5ZJSwhZ5Xb3LE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)