UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HR2rn8rFO6OM4QpWeVrACdq9+anWljm1oBMj24YGGvQ=' 
WHERE 
  key_id = '364b5d156304b574eb2d3c6460a50bbf4a765fc7ab38697194adf263c08697b3' 
  AND (
    token = 'HR2rn8rFO6OM4QpWeVrACdq9+anWljm1oBMj24YGGvQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020