UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OQqzEDXRxMVKH5g7Mer8dhnQAalRFplqOJpseaRCqj8='
WHERE
key_id = '6cdbb40c7f0a2415611c822509b07c4d650851d53a2a7d205b98ff3a27d6d117'
AND (
token = 'OQqzEDXRxMVKH5g7Mer8dhnQAalRFplqOJpseaRCqj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)