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

Query time 0.00039