UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's2mZEVnzecrfpGbuVEnZ8gPVrP+b8mL0o9MNT42WQ7Y=' 
WHERE 
  key_id = '5ea9f457ab6d5068b8300c0c13f902064242e3d44d188ea535d98221e695f671' 
  AND (
    token = 's2mZEVnzecrfpGbuVEnZ8gPVrP+b8mL0o9MNT42WQ7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032