UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dyOI0hmELqJrhTixZbwqOgBbYw9WpgtDIRasiGZugOg=' 
WHERE 
  key_id = 'bd213baa19e1bb1c053d2f7cfb1efa7fca8d538df67a7ac6fb83c798d547b387' 
  AND (
    token = 'dyOI0hmELqJrhTixZbwqOgBbYw9WpgtDIRasiGZugOg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027