UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+GcD1Cgzgr7heca5dwnJGH38CaFBVEyknHV+agIo8AE=' 
WHERE 
  key_id = 'd5e7f9b1bb50aadb20eebab3a883dd9a14db3f040ff896213f5282954dd918f7' 
  AND (
    token = '+GcD1Cgzgr7heca5dwnJGH38CaFBVEyknHV+agIo8AE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034