UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pyOb45n33LULuQtoItob1usVa38nMpB1/ZkXklTpOdw=' 
WHERE 
  key_id = 'fa804865eff018c22a1f67de65e30fa535defe05c000746d5036e336b5cba27e' 
  AND (
    token = 'pyOb45n33LULuQtoItob1usVa38nMpB1/ZkXklTpOdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024