UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Di0dJLnSRXcbPeuh8+5NwAtrm1TvA+Ao/3NTfwHS45k=' 
WHERE 
  key_id = '4e6ed12c16b041d518b100cf0132da73769aa411439c534780be18aa065670ed' 
  AND (
    token = 'Di0dJLnSRXcbPeuh8+5NwAtrm1TvA+Ao/3NTfwHS45k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032