UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6r+X+7frpKBQq2ZXlccucTpYSh9AFTC6O0h7YWazjzQ='
WHERE
key_id = '5c7478657028d37cd2791c17cfa583d5f1f9daecae72e61718941ca3a267a36a'
AND (
token = '6r+X+7frpKBQq2ZXlccucTpYSh9AFTC6O0h7YWazjzQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)