UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '352LizasI3trfX0IsoVHbk1LMUKwc2MVaTs6TRqrLbg=' 
WHERE 
  key_id = '3aae8953e4f064e5db50402042917cb6cd3832a3cf650336bd7814d0dee86032' 
  AND (
    token = '352LizasI3trfX0IsoVHbk1LMUKwc2MVaTs6TRqrLbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036